import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/base/base_state.dart';
import 'package:flutter_app/base/base_stateful_widget.dart';
import 'package:provider/provider.dart';

import 'TestCounter.dart';

class ProviderTwo extends BaseStatefulWidget {
  @override
  _ProviderTwoState createState() => _ProviderTwoState();
}

class _ProviderTwoState extends BaseState<ProviderTwo> {
  @override
  Widget build(BuildContext context) {
    print("---------NextPage---------build---------");
    TestCounter testCounter = Provider.of<TestCounter>(context);
    return  Scaffold(
        appBar: AppBar(title: Text("界面二"),),
        body: Center(
          child: Column(
            children: [
              TextButton(
                  onPressed: () {
                    testCounter.increment();
                  },
                  child: Text("数量加1")),
              Text(testCounter.count.toString())
            ],
          ),
        ),
      ) ;
  }
}
